package com.dennisstepp.tabwidget;

import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TabHost;

import com.dennisstepp.R;
import com.dennisstepp.depressionglass.activities.AmericanSweetheartMonaxActivity;
import com.dennisstepp.depressionglass.activities.AmericanSweetheartPinkActivity;

public class AmericanSweetheartTabWidget extends TabActivity {
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.tablayout);

		Resources res = getResources(); // Resource object to get Drawables
		TabHost tabHost = getTabHost(); // The activity tab host
		TabHost.TabSpec spec; // Reusable TabSpec for each tab
		Intent intent; // Reusable Intent for each tab

		// Create an Intent to launch an Activity for the tab (to be reused)
		intent = new Intent().setClass(this,
				AmericanSweetheartMonaxActivity.class);

		// Initialize a TabSpec for each tab and add it to the TabHost
		spec = tabHost
				.newTabSpec("monax")
				.setIndicator("Monax",
						res.getDrawable(R.drawable.ic_tab_white))
				.setContent(intent);
		tabHost.addTab(spec);

		// Do the same for more tabs
		intent = new Intent().setClass(this,
				AmericanSweetheartPinkActivity.class);

		// Initialize a TabSpec for each tab and add it to the TabHost
		spec = tabHost
				.newTabSpec("pink")
				.setIndicator("Pink",
						res.getDrawable(R.drawable.ic_tab_pink))
				.setContent(intent);
		tabHost.addTab(spec);
		// Set the current tab
		tabHost.setCurrentTab(2);
	}
}
